export class BaseFilter {
  _result = new Set();

  result() {
    return this._result;
  }

  valid(item) {
    return true;
  }
}

export class CustomFilter extends BaseFilter {
  _filter = null;

  constructor(config = null) {
    super();
    if (config === null) {
      this.filter(config.filter);
    }
  }


  filter(filter = null) {
    if (filter !== null) {
      this._filter = filter;
      return this;
    }
    return this._filter;
  }

  valid(item) {
    return this.filter().call(null, item);
  }

}
